#ifndef MACHINE_H
#define MACHINE_H

#include <QObject>

class CPU;
class Memory;
class KeyBoard;
class Monitor;
class BreakPointTable;
class RunningThread;

class Machine : public QObject
{
    Q_OBJECT
public:
    virtual ~Machine();
    //
    static Machine* getInstance(QObject* parent = 0);
    CPU* getCPU();
    Memory* getMemory();
    //
    quint32 loadProgram(const QString& fileName);

public slots:
    void run();
    void stop();
    void step_over();
    void step_into();
    void step_out();

private:
    Machine(QObject *parent = 0);
    void constructTrapTable();

private:
    static Machine* instance;
    CPU* cpu;
    Memory* memory;
    KeyBoard* keyboard;
    Monitor* monitor;
    BreakPointTable* breakPointTable;
    RunningThread* running;

};

#endif // MACHINE_H
